Method and apparatus for obtaining ODN logical topology information, device, and storage medium

ABSTRACT

Embodiments of this application provide a method and an apparatus for obtaining optical distribution network (ODN) logical topology information, a device, and a storage medium. The method includes: obtaining identification information of each first ONU that is connected to a first passive optical network (PON) port and whose optical path changes and feature data of the first ONU in a first time window, where the feature data includes receive optical power and/or an alarm event; obtaining, based on the feature data of each first ONU, a feature vector corresponding to each first ONU; and performing cluster analysis on the feature vector corresponding to each first ONU, to obtain topology information corresponding to the first PON port. ONU topology information is obtained by analyzing an ONU feature.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.17/172,382, filed on Feb. 10, 2021, which is a continuation ofInternational Application No. PCT/CN2019/099926, filed on Aug. 9, 2019,which claims priority to Chinese Patent Application No. 201810931334.9,filed on Aug. 15, 2018. All of the aforementioned applications arehereby incorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to optical network technologies, and inparticular, to a method and an apparatus for obtaining opticaldistribution network (ODN) logical topology information, a device, and astorage medium.

BACKGROUND

FIG. 1 is a schematic architectural diagram of a non-limiting examplepassive optical network system. As shown in FIG. 1 , the passive opticalnetwork (PON) network system mainly includes an optical line terminal(OLT), an optical distribution network (ODN) including a passive opticaldevice, and an optical network unit (ONU) at a user end; and usuallyuses a point-to-multipoint tree-type topology structure. As shown inFIG. 1 , the following may be determined: (1) All ONUs are connected toa PON port of the OLT, that is, there is a specific topologicalrelationship between the ONU and the PON port; and (2) In a specificimplementation, the ONU may be connected to the PON port through alevel-1 optical splitter and/or a level-2 optical splitter, and there isa specific topological relationship between the ONU and the level-2optical splitter. The tree-type topology structure includes at leasttopology information of the ONU and the PON port and topologyinformation of the ONU and the level-2 optical splitter.

According to existing fault handling technologies for home broadband, afault needs to be located. Faults introduced by an OLT, an ONT, and anODN account for a relatively high proportion. However, a faulty scenarioof a PON network is complex, and a line is long. Therefore, the faultneeds to be located based on PON network topology information.Currently, a commonly used approach to obtaining the topologyinformation includes: (1) For topology information of all ONUs connectedto a PON port of an OLT, the PON port that is of the OLT and to whichthe ONUs belong may be determined by using a point-to-point protocolover Ethernet (PPPoE) or the like, and therefore the correspondingtopology information is obtained; or (2) Topology information of an ONUconnected to a specific branch fiber/optical splitter is maintainedthrough manual input.

However, in operation and maintenance process for PON network failures,a correspondence between an ONU and a branch fiber/optical splitter in alive network often changes, maintaining topology information of thebranch fiber/optical splitter through manual input is relativelycumbersome, and the topology information is often inaccurate.

SUMMARY

This application provides a method and an apparatus for obtaining ODNlogical topology information, a device, and a storage medium, to resolvean existing problem that in a operation and maintenance process for PONnetwork failures, a correspondence between an ONU and a branch fiber/anoptical splitter in a live network often changes, and/or maintainingtopology information of the branch fiber/optical splitter through manualinput are relatively cumbersome, and the topology information is ofteninaccurate.

According to a first aspect of an embodiment, this application providesa method for obtaining ODN logical topology information. The methodincludes:

obtaining identification information of each first ONU that is connectedto a first PON port and whose optical path changes and feature data ofthe first ONU in a first time window, where the feature data includes atleast one of receive optical power or an alarm event, and the alarmevent includes an alarm generation time and an alarm type;

obtaining, based on the feature data of each first ONU, a feature vectorcorresponding to the first ONU, where the feature vector correspondingto the first ONU includes a feature of the first ONU that is used toindicate a change of the receive optical power in the first time window,and/or the alarm generation time and the alarm type of the first ONU;and

performing cluster analysis on the feature vector corresponding to eachfirst ONU, to obtain topology information corresponding to the first PONport, where the topology information includes identification informationof at least one group of first ONUs, and identification information ofeach group of first ONUs is used to indicate that the first ONUs in thegroup are connected to a same non-level-1 optical splitter.

In this solution, ONU topology information is obtained by analyzing anONU feature. This is simple and convenient. In addition, the obtainedtopology information is relatively accurate, and no manual input isrequired to maintain topology information of an optical splitter.

In a specific implementation in the foregoing solution, the obtainingidentification information and feature data of each first ONU that isconnected to a first PON port and whose optical path changes includes:

obtaining identification information and feature data of each ONUconnected to the first PON port; and

filtering out, based on the feature data, any ONU that is connected tothe first PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes.

In this solution, a manner in which an electronic device (for example, aserver) that performs the technical solution obtains the identificationinformation and the feature data of each ONU connected to the first PONport may be receiving the identification information and the featuredata of each ONU connected to the first PON port and that are reportedby a data collection device, or may be receiving the identificationinformation and the feature data of each ONU connected to the first PONport and that are reported by an OLT, or may be actively obtaining theidentification information and the feature data of each ONU from a datacollection device or an OLT. This is not limited in embodiments of thepresent disclosure.

Optionally, the feature data of each first ONU further includes adistance measuring result.

In another specific implementation in the foregoing solution, thefiltering out, based on the feature data, any ONU that is connected tothe first PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changesincludes:

comparing a difference between a maximum value and a minimum value ofreceive optical power of an ONU in the first time window with a presetthreshold, and filtering out any ONU whose difference between a maximumvalue and a minimum value of its receive optical power is less than thethreshold, to obtain the identification information and the feature dataof each first ONU that is connected to the first PON port and whoseoptical path changes; and/or

filtering out, based on the alarm generation time and the alarm type ofeach ONU in the first time window, any ONU whose alarm type does notinclude a preset alarm type, to obtain the identification informationand the feature data of each first ONU that is connected to the firstPON port and whose optical path changes.

In the implementation, filtering may be performed by independentlycomparing the difference between the maximum value and the minimum valueof the receive optical power with the threshold, or filtering may beperformed by independently using the preset alarm type, or the foregoingtwo solutions may be combined, that is, filtering is first performedbased on the preset alarm type, and then filtering is performed bycomparing the difference between the maximum value and the minimum valueof the receive optical power with the threshold, or filtering is firstperformed by comparing the difference between the maximum value and theminimum value of the receive optical power with the threshold, and thenfiltering is performed based on the preset alarm type. This is notlimited in embodiments of the present disclosure.

In a specific implementation in the foregoing solution, the obtaining,based on the feature data of each first ONU, a feature vectorcorresponding to each first ONU includes:

for each first ONU, extracting a required feature from the feature dataof the first ONU, to form the feature vector corresponding to the firstONU.

In a specific implementation, a sample vector may be preset, and thesample vector includes a feature required for subsequent clustering.Then, the required feature is extracted from the feature data of thefirst ONU by using the sample vector, to form the feature vectorcorresponding to the first ONU, or the required feature may be directlyextracted from the feature data of the first ONU, to form the featurevector corresponding to the first ONU. This is not limited inembodiments of the present disclosure.

Optionally, the feature of the first ONU that is used to indicate thechange of the receive optical power in the first time window includes atleast two of a jitter degree, a quantity of jitters, a cliff degree, atrend deterioration degree, a relative location of a time at which aminimum value appears for the first time, a relative location of a timeat which a maximum value appears for the first time, a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be greater than an average value, and a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be less than an average value; the jitter degree is astandard deviation or an average deviation of data of the receiveoptical powers of the first ONU in the first time window; the quantityof jitters is an accumulated quantity of times that a jitter degree ofthe first ONU is greater than a preset threshold; the cliff degree isused to indicate an attenuation change of the receive optical power ofthe first ONU from a stable value to another stable value in a unittime; and the trend deterioration degree is indicated by a trendcoefficient obtained through linear fitting after an exponentialweighted moving average is computed on the receive optical powers in thefirst time window.

In another specific implementation, the performing cluster analysis onthe feature vector corresponding to each first ONU, to obtain topologyinformation corresponding to the first PON port includes:

obtaining, based on the feature vector corresponding to each first ONU,a similarity matrix between feature vectors corresponding to any twofirst ONUs; and

using all the obtained similarity matrices as input of a clusteringalgorithm, to obtain the topology information corresponding to the firstPON port.

In another specific implementation, if the first PON port includes atwo-level optical splitting structure, the method further includes:

performing matrix conversion on a historical clustering result (topologyinformation) obtained in each of at least two historical clusteringprocesses corresponding to the first PON port, to obtain a distancematrix corresponding to the historical clustering result, where a valuein the distance matrix represents a distance between any two first ONUs;

adding distance matrices corresponding to the historical clusteringresults obtained in the at least two historical clustering processescorresponding to the first PON port, to obtain a comprehensive distancematrix; and

performing, based on the comprehensive distance matrix in adensity-based clustering manner, cluster analysis on the first ONU thatis connected to the first PON port and whose optical path changes, toobtain new topology information corresponding to the first PON port.

In this solution, accuracy of the obtained topology information can befurther improved by comprehensively analyzing several historicalclustering results.

Based on any one of the foregoing implementations, the method furtherincludes:

generating a corresponding ODN logical topology diagram based on thetopology information corresponding to the first PON port; and

generating for display an interface presenting the ODN logical topologydiagram.

According to a second aspect of an embodiment, this application providesan apparatus for obtaining ODN logical topology information. Theapparatus includes:

an obtaining module, configured to obtain identification information ofeach first ONU that is connected to a first PON port and whose opticalpath changes and feature data of the first ONU in a first time window,where the feature data includes at least one of receive optical powerand an alarm event, and the alarm event includes an alarm generationtime and an alarm type; and

a processing module, configured to obtain, based on the feature data ofeach first ONU, a feature vector corresponding to the first ONU, wherethe feature vector corresponding to the first ONU includes a feature ofthe first ONU that is used to indicate a change of the receive opticalpower in the first time window, and/or the alarm generation time and thealarm type of the first ONU, where

the processing module is further configured to perform cluster analysison the feature vector corresponding to each first ONU, to obtaintopology information corresponding to the first PON port, where thetopology information includes identification information of at least onegroup of first ONUs, and identification information of each group offirst ONUs is used to indicate that the first ONUs in the group areconnected to a same non-level-1 optical splitter.

Optionally, the obtaining module is further configured to:

obtain identification information and feature data of each ONU connectedto the first PON port; and

filter out, based on the feature data, any ONU that is connected to thefirst PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes.

Optionally, the feature data of each first ONU further includes adistance measuring result.

Optionally, the obtaining module is further configured to:

compare a difference between a maximum value and a minimum value ofreceive optical power of an ONU in the first time window with a presetthreshold, and filter out any ONU whose difference between a maximumvalue and a minimum value of its receive optical power is less than thethreshold, to obtain the identification information and the feature dataof each first ONU that is connected to the first PON port and whoseoptical path changes; and/or

filter out, based on the alarm generation time and the alarm type ofeach ONU in the first time window, any ONU whose alarm type does notinclude a preset alarm type, to obtain the identification informationand the feature data of each first ONU that is connected to the firstPON port and whose optical path changes.

Optionally, the processing module is further configured to:

for each first ONU, extract a required feature from the feature data ofthe first ONU, to form the feature vector corresponding to the firstONU.

Optionally, the feature of the first ONU that is used to indicate thechange of the receive optical power in the first time window includes atleast two of a jitter degree, a quantity of jitters, a cliff degree, atrend deterioration degree, a relative location of a time at which aminimum value appears for the first time, a relative location of a timeat which a maximum value appears for the first time, a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be greater than an average value, and a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be less than an average value; the jitter degree is astandard deviation or an average deviation of data of the receiveoptical powers of the first ONU in the first time window; the quantityof jitters is an accumulated quantity of times that a jitter degree ofthe first ONU is greater than a preset threshold; the cliff degree isused to indicate an attenuation change of the receive optical power ofthe first ONU from a stable value to another stable value in a unittime; and the trend deterioration degree is indicated by a trendcoefficient obtained through linear fitting after an exponentialweighted moving average is computed on the receive optical powers in thefirst time window.

Optionally, the processing module is further configured to:

obtain, based on the feature vector corresponding to each first ONU, asimilarity matrix between feature vectors corresponding to any two firstONUs; and

use all similarity matrices as input of a clustering algorithm, toobtain the topology information corresponding to the first PON port.

Optionally, if the first PON port includes a two-level optical splittingstructure, the processing module is further configured to:

perform matrix conversion on a historical clustering result (topologyinformation) obtained in each of at least two historical clusteringprocesses corresponding to the first PON port, to obtain a distancematrix corresponding to the historical clustering result, where a valuein the distance matrix represents a distance between any two first ONUs;

add distance matrices corresponding to the historical clustering resultsobtained in the at least two historical clustering processescorresponding to the first PON port, to obtain a comprehensive distancematrix; and

perform, based on the obtained comprehensive distance matrix in adensity-based clustering manner, cluster analysis on the first ONU thatis connected to the first PON port and whose optical path changes, toobtain new topology information corresponding to the first PON port.

Optionally, the apparatus further includes a display module.

The processing module is further configured to generate a correspondingODN logical topology diagram based on the topology informationcorresponding to the first PON port.

The display module is configured to display the ODN logical topologydiagram.

According to a third aspect of an embodiment, this application providesan electronic device, including a memory, a processor, a receiver, adisplay, and a computer program. The computer program is stored in thememory, and the processor runs the computer program to perform themethod for obtaining ODN logical topology information according to anyone of the first aspect or the possible implementations of the firstaspect.

According to a fourth aspect of an embodiment, this application providesa readable storage medium storing a computer program. The computerprogram, when executed by a computer, causes the computer to perform themethod for obtaining ODN logical topology information according to anyone of the first aspect or the possible implementations of the firstaspect.

According to the method and the apparatus for obtaining ODN logicaltopology information, the device, and the storage medium that areprovided in this application, the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes are obtained; the feature vectorcorresponding to each first ONU is obtained based on the feature data ofeach first ONU; and cluster analysis is performed on the feature vectorcorresponding to each first ONU, to obtain the topology informationcorresponding to the first PON port, where the topology informationincludes identification information of at least one ONU connected to anon-level-1 optical splitter. To be specific, ONU topology informationis directly obtained by analyzing an ONU feature. This is simple andconvenient. In addition, the obtained topology information is relativelyaccurate, and no manual input is required to maintain topologyinformation of an optical splitter, to reduce manual maintenancepressure.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic architectural diagram of a passive optical networksystem according to an embodiment;

FIG. 2 is a flowchart of non-limiting, example Embodiment 1 of a methodfor obtaining ODN logical topology information;

FIG. 3 is a schematic diagram of a jitter degree of receive opticalpower of an ONU according to an embodiment;

FIG. 4 is a schematic diagram of a trend deterioration degree of an ONUaccording to an embodiment;

FIG. 5 is a schematic diagram of a KPI of an ONU according to anembodiment;

FIG. 6 is a flowchart of non-limiting, example Embodiment 2 of a methodfor obtaining ODN logical topology information;

FIG. 7 is a schematic diagram of an ODN logical topology diagramaccording to an embodiment;

FIG. 8 is a schematic structural diagram of non-limiting, exampleEmbodiment 1 of an apparatus;

FIG. 9 is a schematic structural diagram of non-limiting, exampleEmbodiment 2 of an apparatus for obtaining ODN logical topologyinformation according to; and

FIG. 10 is a schematic structural diagram of non-limiting, exampleEmbodiment 1 of an electronic device.

DESCRIPTION OF EMBODIMENTS

In an existing ODN topology discovery solution, for topology informationof all optical network units (ONU) connected to a passive opticalnetwork (PON) port of an optical line terminal (OLT), the PON port thatis of the OLT and to which the ONUs belong may be determined by usingPPPoE. The topology information is accurate. Topology information ofsome ONUs connected to a specific branch fiber/optical splitter ismaintained through manual input. In operation and maintenance processfor PON network failures, a correspondence between the ONU and thebranch fiber/optical splitter in a live network often changes,maintaining topology information of the branch fiber/optical splitterthrough manual input is relatively cumbersome, and the topologyinformation is often inaccurate.

To resolve the foregoing existing problem, an embodiment of thisapplication provides a method for obtaining ODN logical topologyinformation, and the method may be applied to an electronic device. Theelectronic device may be a network server, or may be a speciallydisposed server configured to obtain network topology information, ormay be a terminal device such as a computer that can perform dataanalysis processing, or may be a software module in a server or adevice. This is not limited in embodiments of the present disclosure.Whether an ODN logical topology discovery system is implemented in theserver, the terminal device, or the like, or implemented in anelectronic device by using a software module, the ODN logical topologydiscovery system mainly includes modules such as: (1) a feature datacollection and storage module; (2) an ONU feature mining module; and/or(3) a cluster analysis module, to obtain required topology information.Optionally, the ODN logical topology discovery system may furtherinclude a topology update function module.

In example technical solutions disclosed in this application, massivedevice data indicators are collected, and a big data technology is usedto obtain a key parameter feature of a data indicator during devicerunning A consistency feature of ONU group behavior is fully used, sothat an algorithm model for automatic learning and incremental discoveryof an ODN logical topology is established and applied online, toincrementally discover branch topology information.

The following describes, by using several specific embodiments,non-limiting, example method for obtaining ODN logical topologyinformation. An example PON network system to which the technicalsolution is applied includes a plurality of OLTs. Each OLT is providedwith a PON port, and all ONUs are connected to the PON port. The ONUsmay be connected in an optical splitting manner by using a level-1optical splitter. The ONUs may alternatively be connected in an opticalsplitting manner by using a plurality of level-2 optical splittersconnected to the level-1 optical splitter. Alternatively, the ONUs maybe connected in an optical splitting manner by using level-3 opticalsplitters connected to the level-2 optical splitters. Other cases may beobtained by analogy. In the PON network system, a quantity of opticalsplitting levels is not limited, and optical splitters at differentlevels may be configured based on an actual application requirement toconnect the ONUs.

In a specific implementation of the method for obtaining ODN logicaltopology information, data collected in the ONU includes receive opticalpower, transmit optical power, a bias current, a distance measuringresult, and the like of the ONU. An alarm generation time, an alarmtype, and the like of each ONU connected to the OLT are obtained fromthe OLT device. In an implementation, the receive optical power of theONU may be selected as a key performance indicator (KPI) for analysis.

In addition to the foregoing description, in an embodiment, it should befurther understood that the ONU includes all optical network units, forexample, includes an optical network terminal (ONT), a multi-tenant unit(MTU), a multi-dwelling unit (MDU), and the like.

FIG. 2 is a flowchart of a non-limiting, example Embodiment 1 of amethod for obtaining ODN logical topology information. As shown in FIG.2 , the method for obtaining ODN logical topology informationspecifically includes the following steps:

S101: Obtain identification information of each first ONU, which isconnected to a first PON port and whose optical path changes, andfeature data of the first ONU in a first time window.

This step is usually implemented by a data collection module and astorage module in an electronic device.

In an operation and maintenance process of a PON network system, theelectronic device performing the solution needs to continuously obtainfeature data of each ONU on each PON port. To identify a specific ONU,identification information of different ONUs also needs to besimultaneously obtained. The solution is described by using an examplein which data collection and processing analysis are performed on a PONport (namely, the first PON port).

Feature data of the ONU in the first time window includes at least oneof receive optical power and an alarm event, and the alarm eventincludes an alarm generation time and an alarm type. The first timewindow herein may be set based on an actual situation, and is notlimited herein.

Usually, a manner of obtaining identification information and featuredata of all first ONUs, which are connected to a PON port and whoseoptical paths change, is obtaining the identification information andthe feature data of each ONU connected to the first PON port, and thenfiltering out, based on the feature data, any ONU that is connected tothe first PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes. In aspecific implementation, at least the following two manners areincluded.

In a first implementation, the identification information and thefeature data of each ONU connected to the first PON port and that aresent by a data collection device are received; and the ONU that isconnected to the first PON port and whose optical path does not changeis filtered out based on the feature data, to obtain the identificationinformation and the feature data of each first ONU that is connected tothe first PON port and whose optical path changes.

A data collection platform, also referred to as the data collectiondevice, may be specially disposed, to collect data. In a runningprocess, the ONU periodically reports the feature data of the ONU to thedata collection device. A reporting period may be configured based on anactual situation, for example, the reporting period is 5 minutes. Thedata collection device receives the feature data reported by the ONU onthe first PON port, and correspondingly stores the feature data based onthe identification information of the ONU. The feature data herein mayinclude data of the receive optical power of the ONU, the alarm event, adistance measuring result, and the like, to facilitate topology learningin a subsequent analysis process.

In an embodiment, after obtaining the identification information and thefeature data of all the ONUs, the data collection device reports thedata to an execution body, e.g., the electronic device. In a process ofprocessing the data, the electronic device filters ONUs on the first PONport based on the feature data to filter out any ONU whose optical pathdoes not change, and leaves only identification information and featuredata of all first ONUs whose optical paths change.

Optionally, in a specific implementation in the solution, the datacollection device may alternatively screen ONUs on the first PON portbased on the feature data to filter out any ONU whose optical path doesnot change, leave only the identification information and the featuredata of the first ONU whose optical path changes, and then reports, tothe electronic device, the identification information and the featuredata of the ONU whose optical path changes. This is not limited inembodiments of the present disclosure.

In a second implementation, the identification information and thefeature data, which are of each ONU connected to the first PON port andare sent by a first OLT, are received; and the ONU that is connected tothe first PON port and whose optical path does not change is filteredout based on the feature data, to obtain the identification informationand the feature data of each first ONU that is connected to the firstPON port and whose optical path changes.

In this solution, there is no need to specially dispose a datacollection device. The ONU may periodically report the feature data tothe OLT, and then the OLT periodically reports the obtainedidentification information and corresponding feature data of the ONU tothe electronic device for processing and analysis. A reporting periodmay be configured based on an actual situation, for example, thereporting period is 15 minutes.

Similarly, in an embodiment, after obtaining the identificationinformation and the corresponding feature data of the ONU, the OLT mayfilter out any ONU whose optical path does not change, then obtain theidentification information and the feature data of the first ONU whoseoptical path changes, and reports, to the electronic device thatperforms data analysis and topology learning, the identificationinformation and the feature data of each first ONU whose optical pathchanges.

Alternatively, after obtaining the identification information and thecorresponding feature data of the ONU, the OLT may directly report theidentification information and the feature data of the first ONU whoseoptical path changes. After receiving the identification information andthe corresponding feature data of the ONU on the first PON port, theelectronic device filters out any ONU whose optical path does notchange, and then obtains the identification information and feature dataof each first ONU whose optical path changes.

In a specific implementation in the foregoing solution, the feature dataof each first ONU may further include a distance measuring result.

In the foregoing two implementation solutions, the receivedidentification information and feature data of the ONUs need to befiltered, to filter out any ONU whose optical path does not change.Specifically, filtering may be performed in the following manners:

(1) A difference between a maximum value and a minimum value of receiveoptical power of an ONU in the first time window is compared with apreset threshold, and an ONU whose difference between a maximum valueand a minimum value of its receive optical power is less than thethreshold is filtered out, to obtain the identification information andthe feature data of each first ONU that is connected to the first PONport and whose optical path changes.

In this solution, it means that filtering is performed by using adifference between a maximum value and a minimum value of receiveoptical power of a same ONU in the first time window is greater than orequal to an expert experience threshold. For example, the threshold maybe preconfigured as follows:RxPower_(min) −RxPower_(min) ≥RxPower_(th).

Herein, RxPower_(max) is the maximum value of the receive optical powerof the ONU in the first time window, RxPower_(min) is the minimum valueof the receive optical power of the ONU in the first time window, andRxPower_(th) is a specified threshold, for example, may be set to 1 dBby default.

According to the foregoing formula, the ONU whose difference between themaximum value and the minimum value of the receive optical power is lessthan the threshold is filtered out, to obtain the identificationinformation and the feature data of each first ONU that is connected tothe first PON port and whose optical path changes.

(2) An ONU whose alarm type is not a preset alarm type is filtered outbased on an alarm generation time and an alarm type of each ONU in thefirst time window, to obtain the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes.

In this solution, it means that a required alarm type is preset, the ONUthat is not of the specified preset alarm type is filtered out based onthe alarm generation time and the alarm type of each ONU in the firsttime window, and then the identification information and the featuredata of each first ONU that is connected to the first PON port and whoseoptical path changes remain. For example, the required preset alarm typesuch as a loss of signal (LOS) or a loss of frame (LOF) may be preset.In a specific implementation, the preset alarm type is usually an alarmindicating that an optical path is interrupted. In an embodiment, it maybe understood that the LOF indicates that if the OLT cannot locate anupstream frame of an ONU for four consecutive frames, the OLT generatesan LOF alarm, and may disconnect the ONU. The LOS indicates that if theOLT cannot receive, for four consecutive frames, an upstream opticalsignal sent by an ONU, the OLT generates an LOS alarm, and maydisconnect the ONU.

(3) The foregoing two manners are combined. To be specific, after thedifference between the maximum value and the minimum value of thereceive optical power in the feature data is compared with the specifiedthreshold, the ONU whose difference between the maximum value and theminimum value of the receive optical power is less than the threshold isfiltered out, and then remaining ONUs are filtered by using the presetalarm type, to finally obtain the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes.

S102: Obtain, based on the feature data of each first ONU, a featurevector corresponding to the first ONU, where the feature vectorcorresponding to the first ONU includes a feature of the first ONU thatis used to indicate a change of the receive optical power in the firsttime window, and/or the alarm generation time and the alarm type of thefirst ONU.

In this step, after obtaining the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes, the electronic device needs to obtainthe feature vector of each ONU. The feature vector includes the featureof the first ONU that is used to indicate the change of the receiveoptical power in the first time window, and/or the alarm generation timeand the alarm type of the first ONU. In a specific implementation, foreach first ONU, a required feature may be extracted from the featuredata of the first ONU based on a predefined sample vector, to form thefeature vector corresponding to the first ONU.

The feature of the first ONU that is used to indicate the change of thereceive optical power in the first time window includes at least two ofa jitter degree, a quantity of jitters, a cliff degree, a trenddeterioration degree, a relative location of a time at which a minimumvalue appears for the first time, a relative location of a time at whicha maximum value appears for the first time, a proportion of a length ofa longest continuous subsequence in which receive optical power remainsto be greater than an average value, and a proportion of a length of alongest continuous subsequence in which receive optical power remains tobe less than an average value, wherein the jitter degree is a standarddeviation or an average deviation of data of receive optical power ofthe ONU in the first time window, the quantity of jitters is anaccumulated quantity of times when a jitter degree of the ONU is greaterthan a preset threshold, the cliff degree is used to indicate anattenuation change of the receive optical power of the ONU from a stablevalue to another stable value in a unit time, and the trenddeterioration degree is indicated by a trend coefficient obtainedthrough linear fitting after an exponential weighted moving average iscomputed on receive optical power in the first time window.

In addition, if the feature vector corresponding to the first ONUincludes the alarm event, the feature vector specifically includes thealarm generation time and the alarm type.

In this embodiment, it means that a sample feature vector is firstdefined, and is also referred to as a sample vector. The sample vectorincludes the feature (also referred to as a feature of a time sequenceof the receive optical power of the ONU) that is of the first ONU andthat is used to indicate the change of the receive optical power in thefirst time window, including the at least two of the jitter degree, thequantity of jitters, the cliff degree, the trend deterioration degree,the time at which the minimum value appears for the first time, the timeat which the maximum value appears for the first time, the length of thelongest continuous subsequence in which receive optical power remains tobe greater than the average value, and the length of the longestcontinuous subsequence in which receive optical power remains to be lessthan the average value; the alarm event of the ONU, including the alarmgeneration time and the alarm type; and an optical distance between theONU and the OLT, including a measured distance (also referred to as adistance measuring result). The feature of the time sequence of theoptical power is to analyze a sequence within a time window, and a timelength needs to be configured, for example, may be configured as oneday.

A sample vector is specifically shown as follows:

$X = {\left\{ {x_{1},x_{2},x_{3},x_{4},x_{5},x_{6},x_{7},x_{8},x_{9},x_{10},x_{11}} \right\} = \left\{ \begin{matrix}x_{1} & {{represents}{the}{jitter}{{degree}.}} \\x_{2} & {{represents}{the}{quantity}{of}{{jitters}.}} \\x_{3} & {{represents}{the}{cliff}{{degree}.}} \\x_{4} & {{represents}{the}{trend}{deterioration}} \\ & {{degree}.} \\x_{5} & {{represents}{the}{relative}{location}} \\ & {{of}{the}{time}{at}{which}{the}{minimum}} \\ & {{value}{appears}{for}{the}{first}{{time}.}} \\x_{6} & {{represents}{the}{relative}{location}} \\ & {{of}{the}{time}{at}{which}{the}{maximum}} \\ & {{value}{appears}{for}{the}{first}{{time}.}} \\X_{7} & {{represents}{the}{proportion}{of}{the}} \\ & {{length}{of}{the}{longest}{continuous}} \\ & {{subsequence}{greater}{than}{the}{average}} \\ & {{value}.} \\X_{8} & {{represents}{the}{proportion}{of}{the}} \\ & {{length}{of}{the}{longest}{continuous}} \\ & {{subsequence}{less}{than}{the}{average}} \\ & {{value}.} \\X_{9} & {{represents}{the}{alarm}{generation}} \\ & {{time}.} \\X_{10} & {{represents}{the}{alarm}{{type}.}} \\X_{11} & {{represents}a{measured}{{distance}.}}\end{matrix} \right.}$

After obtaining the feature data of all the first ONUs, the electronicdevice analyzes configured KPI data and a configured time window byusing a big data technology, and extracts a parameter from the featuredata, to obtain the feature vector of each first ONU. Each parameter inthe feature vector is specifically described below. Details are asfollows:

(a) Jitter degree: FIG. 3 is a schematic diagram of a jitter degree ofreceive optical power of an ONU according to an embodiment. As shown inFIG. 3 , it can be learned that the receive optical power of the ONUusually changes slightly. When an optical path between the OLT and theONU changes, receive optical power of a plurality of ONTs/ONUs connectedto a same PON port of the OLT device change. A standard deviation ofdata of the receive optical power of the ONUs in a time window may beseparately calculated to represent the jitter degree.

(b) Quantity of jitters: An accumulated quantity of times that thejitter degree is greater than a threshold may be used to represent thequantity of jitters.

(c) Cliff degree: The cliff degree indicates an attenuation change ofthe receive optical power of the ONU from a stable value to anotherstable value in a unit time. The attenuation change is greater than athreshold, for example, an attenuation threshold is 3 dB. If anattenuation degree, namely, a loss, is less than the threshold, theattenuation degree is directly set to 0. If an attenuation degree isgreater than the threshold, a normalized value is used. A normalizedprocessing mode is (loss−loss_(min))/(loss_(max)−loss_(min)), whereloss_(max) and loss_(min) are respectively a maximum value and a minimumvalue of a cliff of the ONU. The unit time herein may be one collectionperiod, or may be a plurality of collection periods, and the unit timemay be set based on an actual situation.

(d) Trend deterioration degree: FIG. 4 is a schematic diagram of a trenddeterioration degree of an ONU according to an embodiment. FIG. 4 showsthe deterioration degree of the ONU. The electronic device computes anexponential weighted moving average (EWMA) on the KPI in the first timewindow, then performs linear fitting, and uses a trend coefficient asthe deterioration degree.

(e) Relative location of the time at which the minimum value appears forthe first time: The relative location is a relative location of the timeat which the minimum value of the receive optical power of the ONU inthe first time window appears for the first time relative to the entiretime sequence. For example, a sequence of receive optical power startsfrom a moment t0, there is a maximum value during a sudden decrease at amoment t1, and a time at which the sequence ends is tn. In this case,the relative location of the time at which the minimum value appears forthe first time is equal to (t1−t0)/(tn−t0).

(f) Relative location of the time at which the maximum value appears forthe first time: The relative location is a relative location of the timeat which the maximum value of the receive optical power of the ONU inthe first time window appears for the first time relative to the entiretime sequence. For example, a sequence of receive optical power startsfrom a moment t0, there is a maximum value during a sudden increase at amoment t1, and a time at which the sequence ends is tn. In this case,the relative location of the time at which the maximum value appears forthe first time is equal to (t1−t0)/(tn−t0).

(g) Proportion of the length of the longest continuous subsequence inwhich receive optical power remains to be greater than the averagevalue: An average value of receive optical power of an ONU in a timewindow is calculated, then statistics on lengths of continuoussubsequences in which receive optical power remains to be greater thanthe average value are collected, and a longest subsequence is selected.For example, a time span of a longest continuous subsequence in whichreceive optical power remains to be greater than an average value inreceive optical power time sequence is L1, and a time span of the entiresequence is L0. In this case, the feature value may be obtained by usingL1/L0.

(h) Proportion of the length of the longest continuous subsequence inwhich receive optical power remains to be less than the average value:An average value of receive optical power of an ONU in a time window iscalculated, then statistics on lengths of continuous subsequences inwhich receive optical power remains to be less than the average valueare collected, and a longest subsequence is selected. For example, atime span of a longest continuous subsequence in which receive opticalpower remains to be less than an average value in receive optical powertime sequence is L2, and a time span of the entire sequence is L0. Inthis case, the feature value may be obtained by using L2/L0.

(i) Alarm generation time: The alarm generation time is also referred toas a relative time at which an alarm is generated or a time at which theONU generates an alarm. For example, when a level-2 backbone opticalfiber is faulty, a plurality of ONUs connected to a same PON port of theOLT device generate alarms in a relatively short time. Assuming that thealarm generation time is t_(a1), a time at which a time sequence startsis to, and a time at which the time sequence ends is t_(n),(t_(a1)−t₀)/(t_(n)−t₀) is used to represent the feature value.

(j) Alarm type: The alarm type is a type of an alarm generated by theONU. For example, when a level-2 backbone optical fiber is faulty, aplurality of ONUs connected to a same PON port of the OLT devicegenerate key alarms in an approximate time window. For example, if anONU generates an LOS alarm or an LOF alarm, the feature value is 1; orif an ONU does not generate an LOS alarm or an LOF alarm, the featurevalue is 0.

(k) Measured distance of the ONU: The measured distance is a distancebetween the ONU and the PON port of the OLT device, and may be collectedon the ONU device. The measured distance changes slightly with a time. Ameasured distance of a given ONU may be considered as an average valuein a sequence. Assuming that an optical measured distance of the ONU isLen1, and a maximum measured distance in measured distances of all ONUson the PON port is maxLen, Len1/maxLen is used as the feature value ofthe measured distance of the ONU.

After the feature vector of each first ONU is obtained in the foregoingmanner, cluster analysis is performed on the feature vector of each ONU,that is, a subsequent process is performed.

S103: Perform cluster analysis on the feature vector corresponding toeach first ONU, to obtain topology information corresponding to thefirst PON port, where the topology information includes identificationinformation of at least one group of first ONUs, and identificationinformation of each group of first ONUs is used to indicate that thefirst ONUs in the group are connected to a same non-level-1 opticalsplitter.

A plurality of ONUs are connected to the non-level-1 optical splittersuch as a level-2 optical splitter or a level-3 optical splitter. Whennon-level-1 light or the non-level-1 optical splitter is abnormal,behaviors of KPI of ONUs on the same PON port of the OLT device aresimilar. For example, FIG. 5 is a schematic diagram of a KPI of an ONUaccording to an embodiment. As shown in FIG. 5 , feature data of ONUsconnected to a same level-2 optical splitter is similar to some extent,that is, KPIs are similar to some extent. Therefore, after the featurevector corresponding to each first ONU is obtained, cluster analysis maybe performed based on the feature vector, to determine which first ONUsare connected to the same non-level-1 optical splitter.

The following describes the clustering process by using an example inwhich the non-level-1 optical splitter is a level-2 optical splitter.Usually, the clustering process may be implemented by using a clusteringalgorithm, and in particular, ONUs may be clustered by using asimilarity-based clustering algorithm. For example, in the clusteringanalysis process, an affinity propagation (AP) clustering algorithm maybe used. Detailed implementation steps are as follows:

(a) Feature vectors X_(i)={x₁,x₂,x₃,x₄,x₅,x₆,x₇,x₈,x₉,x₁₀,x₁₁} of allfirst ONUs whose optical paths change and that are connected to the samePON port of the OLT device are extracted in step S102, where a featurevector of each first ONU is used as a node.

(b) A similarity between a node i and a node j is represented as S(i,j). The formula is shown as follows, that is, is a negative value of aEuclidean distance between the feature vectors. A larger value of S(i,j) indicates that the node i is closer to the node j. During APclustering, the node j is used as a capability of a clustering center ofthe node i. A similarity matrix mat-S may be obtained by calculating asimilarity between every two first ONUs of all the first ONUs. If thereare p ONUs, a dimension of the generated similarity matrix mat-S is p*p.

${S\left( {i,j} \right)} = {- {\sqrt{\sum\limits_{k = 1}^{N}\left( {x_{ik} - x_{jk}} \right)^{2}}.}}$Herein, N represents a quantity of features of the feature vector.

(c) The similarity matrix mat-S is used as input of AP clustering, sothat a clustering result can be obtained. For example, the clusteringresult is as follows: It is assumed that a1, a2, a3, a5, and a6 arenumbers of different ONUs on the first PON port. If a1, a2, and a3 aremore similar to each other, and a5 and a6 are more similar to eachother, the clustering result is expressed in a form of {‘cluster-1’:[a1, a2, a3], ‘cluster-2’: [a5, a6]}, in other words, similar ONUs areclustered in a cluster. For example, the non-level-1 optical splitter isthe level-2 optical splitter. A meaning of a topology corresponding tothe clustering result {‘cluster-1’: [a1, a2, a3], ‘cluster-2’: [a5, a6]}is: a1, a2, and a3 are connected to a same level-2 optical splitter, anda5 and a6 are connected to a same level-2 optical splitter.

To be specific, cluster analysis may also be performed, in the foregoingmanner, on ONUs connected to an optical splitter at another level, tofinally obtain the topology information corresponding to the first PONport. The topology information includes identification information of aplurality of groups of ONUs. It means that ONUs corresponding toidentification information of the ONUs in each group are connected tothe same non-level-1 optical splitter.

Optionally, after performing the foregoing step, the electronic devicemay further generate a corresponding ODN logical topology diagram basedon the obtained topology information of the PON port, and directlydisplay the ODN logical topology diagram to a user, so that the user candirectly determine a topology status of the ONU.

According to the method for obtaining ODN logical topology informationprovided in this embodiment, the electronic device such as the server orthe terminal device obtains the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes; obtains, based on the feature data ofeach first ONU, the feature vector corresponding to each first ONU; andperforms cluster analysis on the feature vector corresponding to eachfirst ONU, to obtain the topology information corresponding to the firstPON port, where the topology information includes identificationinformation of at least one ONU connected to the non-level-1 opticalsplitter. To be specific, ONU topology information is directly obtainedby analyzing an ONU feature. This is simple and convenient. In addition,the obtained topology information is relatively accurate, and no manualinput is required to maintain topology information of an opticalsplitter, to reduce manual maintenance pressure.

In some cases, the ODN changes because some ONUs are disconnected oroperation and maintenance personnel replaces the ONUs through plug-inand plug-out. Therefore, in an embodiment, the topology may be furtherupdated by using a topology update module. Historical topology discoverydata in a specific period of time is stored, and comprehensivedetermining is performed by using a current newly discovered topologyand several historical topologies, to obtain actual ODN topologyinformation that more conforms to an actual situation. Details aredescribed below by using some example embodiments.

FIG. 6 is a flowchart of a non-limiting, example Embodiment 2 of amethod for obtaining ODN logical topology information. As shown in FIG.6 , based on the foregoing embodiments, if the first PON port includes atwo-level optical splitting structure, the method for obtaining ODNlogical topology information further includes the following steps.

S201: Perform matrix conversion on topology information (historicalclustering results) obtained in at least two historical clusteringprocesses corresponding to the first PON port, to obtain a distancematrix corresponding to each historical clustering result, where a valuein the distance matrix represents a distance between any two first ONUs.

In this step, a quantity of historical topologies N-topology stored inthe electronic device may be set through configuration. If N-topology isset to 3, data of two historical topologies is stored, and comprehensiveanalysis is performed by using a current topology and the two historicaltopologies.

In an example topology update solution, a single clustering result of alogical topology, namely, single topology information, is firstconverted into a distance matrix between every two ONUs. It is assumedthat a clustering result is {‘cluster 1’: [a1, a2, a3, a4], ‘cluster 2’:[a5, a6, a7, a8]}, where a1, . . . , and a8 are numbers of differentONUs on the first PON port, that is, a1, a2, a3, and a4 may be connectedto a same level-2 optical splitter, and a5, a6, a7, and a8 may beconnected to a same level-2 optical splitter, and is also represented as{‘level-2 optical splitter 1’: [a1, a2, a3, a4], ‘level-2 opticalsplitter 2’: [a5, a6, a7, a8]}. The clustering result is converted intoa distance matrix. Details are as follows:

$\begin{matrix}{a1} & {a2} & {a3} & {a4} & {a5} & {a6} & {a7} & {a8}\end{matrix}$ $\begin{matrix}{a1} \\{a2} \\{a3} \\{a4} \\{a5} \\{a6} \\{a7} \\{a8}\end{matrix}\begin{pmatrix}0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0\end{pmatrix}$

In the matrix, 0 indicates similarity, and 1 indicates dissimilarity.

Assuming that a clustering result (namely, topology information) of thefirst historical topology is {‘level-2 optical splitter 1’: [a1, a3,a4], ‘level-2 optical splitter 2’: [a5, a6, a7, a8]}, the clusteringresult may also be converted into a distance matrix. Details are asfollows:

$\begin{matrix}{a1} & {a2} & {a3} & {a4} & {a5} & {a6} & {a7} & {a8}\end{matrix}$ $\begin{matrix}{a1} \\{a2} \\{a3} \\{a4} \\{a5} \\{a6} \\{a7} \\{a8}\end{matrix}\begin{pmatrix}0 & 1 & 0 & 0 & 1 & 1 & 1 & 1 \\1 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0\end{pmatrix}$

In the matrix, 0 indicates similarity, and 1 indicates dissimilarity.

Assuming that a clustering result (namely, topology information) of thesecond historical topology is {‘level-2 optical splitter 1’: [a1, a2,a4], ‘level-2 optical splitter 2’: [a5, a6, a7, a8]}, the clusteringresult may also be converted into a distance matrix. Details are asfollows:

$\begin{matrix}{a1} & {a2} & {a3} & {a4} & {a5} & {a6} & {a7} & {a8}\end{matrix}$ $\begin{matrix}{a1} \\{a2} \\{a3} \\{a4} \\{a5} \\{a6} \\{a7} \\{a8}\end{matrix}\begin{pmatrix}0 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\1 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 \\1 & 1 & 1 & 1 & 0 & 0 & 0 & 0\end{pmatrix}$

In the matrix, 0 indicates similarity, and 1 indicates dissimilarity.

S202: Add distance matrices corresponding to at least two historicalclustering results corresponding to the first PON port, to obtain acomprehensive distance matrix.

In this step, a plurality of historical clustering results correspondingto the first PON port, namely, the distance matrices corresponding tothe topology information obtained by using the solution in Embodiment 1,may be summed up in a manner of the foregoing step, to obtain acomprehensive distance matrix. Specifically, in the foregoing instance,a comprehensive distance matrix may be obtained by adding the foregoingthree distance matrices:

$\begin{matrix}{a1} & {a2} & {a3} & {a4} & {a5} & {a6} & {a7} & {a8}\end{matrix}$ $\begin{matrix}{a1} \\{a2} \\{a3} \\{a4} \\{a5} \\{a6} \\{a7} \\{a8}\end{matrix}\begin{pmatrix}0 & 1 & 1 & 0 & 3 & 3 & 3 & 3 \\1 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\1 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\0 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0\end{pmatrix}$

Optionally, in an embodiment, the foregoing comprehensive distancematrix may be further corrected, to improve accuracy of the clusteringresult. In a specific implementation method, each element in the matrixis corrected. In a correction manner, if a value of the element is lessthan a specified threshold th1, the value of the element is set to 0; orif a value of the element is not less than a specified threshold th1,the value of the element is set to n.

The threshold th1 is a minimum integer greater than or equal to n×0.6.Herein, if n=3, the threshold is 2. To be specific, a value less than 2in the foregoing matrix is set to 0, and another value is set to 3. Inthis way, the following corrected matrix may be obtained:

$\begin{matrix}{a1} & {a2} & {a3} & {a4} & {a5} & {a6} & {a7} & {a8}\end{matrix}$ $\begin{matrix}{a1} \\{a2} \\{a3} \\{a4} \\{a5} \\{a6} \\{a7} \\{a8}\end{matrix}\begin{pmatrix}0 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\0 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\0 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\0 & 0 & 0 & 0 & 3 & 3 & 3 & 3 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0 \\3 & 3 & 3 & 3 & 0 & 0 & 0 & 0\end{pmatrix}$

S203: Perform, based on the comprehensive distance matrix in adensity-based clustering manner, cluster analysis on the first ONU thatis connected to the first PON port and whose optical path changes, toobtain new topology information corresponding to the first PON port.

In this step, after the comprehensive distance matrix is obtained, thedensity-based clustering method may be used to perform cluster analysisagain on the first ONU that is connected to the PON port and whoseoptical path changes, to obtain a new clustering result, namely, the newtopology information.

Based on the comprehensive matrix obtained in the foregoing instance,the density-based clustering method, for example, density-based spatialclustering of applications with noise (DBSCAN), is used for the matrix.If a neighborhood distance is set to th1 (e.g., the threshold obtainedin the previous step), and a minimum quantity of neighboring objectsminPts is set to 3 (may be set to a minimum quantity of ONUs in level-2optical splitting based on an actual situation), it can be learned thata combination of the three clustering results is {‘level-2 opticalsplitter 1’: [a1, a2, a3, a4], ‘level-2 optical splitter 2’: [a5, a6,a7, a8]}.

The clustering result indicates that a1, a2, a3, and a4 are connected tothe level-2 optical splitter 1, and a5, a6, a7, and a8 are connected tothe level-2 optical splitter 2.

In this solution, clustering principles and steps of DBSCAN are asfollows:

(a) Input: a sample set D, a neighborhood radius eps, and a minimumquantity of neighborhood sample points minPts.

(b) Concepts:

Neighborhood: For any object in D, if a Euclidean distance betweenanother sample point and the object is less than eps, it is consideredthat the other sample point is located in a neighborhood of eps of theobject.

Core object: If a quantity of sample points in a neighborhood of eps ofa given object is greater than or equal to minPts, the object isreferred to as the core object.

Direct density reachability: For two sample points p and q in D, if p isin a neighborhood of eps of q, and q is a core object, it is consideredthat the object p is directly density-reachable from q.

Density reachability: For the sample set D, if there is an object chainp₁, p₂, . . . , and p_(n), p₁=p, p_(n)=p, and for p_(i)∈D(1≤i≤n),p_(i+1) is directly density-reachable from p_(i) about eps and minPts,the object p is density-reachable from the object q about theneighborhood of eps and minPts.

Density connectivity: If there is an object q so that both p and q aredensity-reachable from o about eps and minPts, the objects p and q aredensity-connected about eps and minPts.

(c) Clustering steps:

Step 1. Determine whether an input point is a core object.

Step 2: If the input point is determined to be a core object, find alldirectly density-reachable points in a neighborhood of eps of thedetermined core object.

Step 3: Repeat step 1 and step 2 for each of the input points until thedetermination of all the input points is completed.

Step 4: Find a maximum density connectivity object set for all directlydensity-reachable points in neighborhoods of eps of all core objects,and combine density-reachable objects to form a cluster.

Step 5: Repeat step 4 until the neighborhoods of eps of all the coreobjects are traversed. In this case, a plurality of formed clusters arefinal clustering results.

Based on the foregoing embodiments, in an embodiment, the method forobtaining ODN logical topology information provided in this applicationfurther includes the following steps: generating a corresponding ODNlogical topology diagram based on the topology information correspondingto the first PON port; and displaying the ODN logical topology diagram.

FIG. 7 is a schematic diagram of an ODN logical topology diagramaccording to an embodiment. As shown in FIG. 7 , the ODN logicaltopology diagram generated based on the topology information obtainedthrough clustering shows that the PON port is connected to a level-1optical splitter, the level-1 optical splitter is connected to a level-2optical splitter 1 and a level-2 optical splitter 2, four ONUs a1, a2,a3, and a4 on the PON port are connected to the same level-2 opticalsplitter 1, and four ONUs a5, a6, a7, and a8 on the PON port areconnected to the same level-2 optical splitter 2.

According to the method for obtaining ODN logical topology informationprovided in this embodiment, a problem that fault locating is difficult,a locating time is long, and maintenance costs are high because a branchtopology (for example, a level-2 topology) is unknown and resourcemanagement system data of the branch topology (for example, the level-2topology) is inaccurate is resolved. In addition, cost overheads causedby manually maintaining resource management information can be reduced,and inaccurate resource management information caused by a frequentchange of a correspondence between the ONT and the level-2 opticalsplitter can be avoided. Moreover, the topology information is used toimprove a remote automatic locating rate, reduce dependency on aprofessional maintenance tool, reduce a quantity of invalid on-sites ofdevice maintenance personnel, improve processing efficiency, and reducemaintenance costs.

FIG. 8 is a schematic structural diagram of non-limiting, exampleEmbodiment 1 of an apparatus. As shown in FIG. 8 , the apparatus 10 forobtaining ODN logical topology information includes:

an obtaining module 11, configured to obtain identification informationof each first ONU that is connected to a first PON port and whoseoptical path changes and feature data of the first ONU in a first timewindow, where the feature data includes at least one of receive opticalpower and an alarm event, and the alarm event includes an alarmgeneration time and an alarm type; and a processing module 12,configured to obtain, based on the feature data of each first ONU, afeature vector corresponding to the first ONU, where the feature vectorcorresponding to the first ONU includes a feature of the first ONU thatis used to indicate a change of the receive optical power in the firsttime window, and/or the alarm generation time and the alarm type of thefirst ONU, where the processing module 12 is further configured toperform cluster analysis on the feature vector corresponding to eachfirst ONU, to obtain topology information corresponding to the first PONport, where the topology information includes identification informationof at least one group of first ONUs, and identification information ofeach group of first ONUs is used to indicate that the first ONUs in thegroup are connected to a same non-level-1 optical splitter.

The apparatus for obtaining ODN logical topology information provided inthis embodiment is configured to perform the technical solution providedin any one of the foregoing method embodiments. An implementationprinciple and a technical effect of the apparatus are similar to thoseof the technical solution provided above. ONU topology information isobtained by analyzing an ONU feature. This is simple and convenient. Inaddition, the obtained topology information is relatively accurate, andno manual input is required to maintain topology information of anoptical splitter.

Based on the foregoing embodiment, in a specific implementation, theobtaining module 11 is further configured to:

obtain identification information and feature data of each ONU connectedto the first PON port; and

filter out, based on the feature data, any ONU that is connected to thefirst PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes.

Optionally, the feature data of each first ONU further includes adistance measuring result.

Optionally, the obtaining module 11 is further configured to:

compare a difference between a maximum value and a minimum value ofreceive optical power of an ONU in the first time window with a presetthreshold, and filter out an ONU whose difference between a maximumvalue and a minimum value of its receive optical power is less than thethreshold, to obtain the identification information and the feature dataof each first ONU that is connected to the first PON port and whoseoptical path changes; and/or filter out, based on the alarm generationtime and the alarm type of each ONU in the first time window, any ONUwhose alarm type does not include a preset alarm type, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes.

Optionally, the processing module 12 is further configured to:

for each first ONU, extract a required feature from the feature data ofthe first ONU, to form the feature vector corresponding to the firstONU.

Optionally, the feature of the first ONU that is used to indicate thechange of the receive optical power in the first time window includes atleast two of a jitter degree, a quantity of jitters, a cliff degree, atrend deterioration degree, a relative location of a time at which aminimum value appears for the first time, a relative location of a timeat which a maximum value appears for the first time, a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be greater than an average value, and a proportion of alength of a longest continuous subsequence in which receive opticalpower remains to be less than an average value; the jitter degree is astandard deviation or an average deviation of data of receive opticalpower of the ONU in the first time window; the quantity of jitters is anaccumulated quantity of times that a jitter degree of the ONU is greaterthan a preset threshold; the cliff degree is used to indicate anattenuation change of the receive optical power of the ONU from a stablevalue to another stable value in a unit time; and the trenddeterioration degree is indicated by a trend coefficient obtainedthrough linear fitting after an exponential weighted moving average iscomputed on the receive optical power in the first time window.

Optionally, the processing module 12 is further configured to:

obtain, based on the feature vector corresponding to each first ONU, asimilarity matrix between feature vectors corresponding to any two firstONUs; and

use all similarity matrices as input of a clustering algorithm, toobtain the topology information corresponding to the first PON port,where the topology information corresponding to the first PON portincludes identification information of a plurality of groups of firstONUs, and identification information of each group of first ONUs is usedto determine that the first ONUs in the group are connected to a samelevel-2 optical splitter.

Optionally, if the first PON port includes a two-level optical splittingstructure, the processing module 12 is further configured to:

perform matrix conversion on a historical clustering result (topologyinformation) obtained in each of at least two historical clusteringprocesses corresponding to the first PON port, to obtain a distancematrix corresponding to the historical clustering result, where a valuein the distance matrix represents a distance between any two first ONUs;

add distance matrices corresponding to the historical clustering resultsobtained in the at least two historical clustering processescorresponding to the first PON port, to obtain a comprehensive distancematrix; and

perform, based on the comprehensive distance matrix in a density-basedclustering manner, cluster analysis on the first ONU that is connectedto the first PON port and whose optical path changes, to obtain newtopology information corresponding to the first PON port.

The apparatus for obtaining ODN logical topology information provided inany one of the foregoing embodiments is configured to perform thetechnical solution provided in any one of the foregoing methodembodiments. An implementation principle and a technical effect of theapparatus are similar to those of the technical solution. Details arenot described herein again.

FIG. 9 is a schematic structural diagram of non-limiting, exampleEmbodiment 2 of an apparatus for obtaining ODN logical topologyinformation. As shown in FIG. 9 , based on any one of the foregoingembodiments, the apparatus 10 for obtaining ODN logical topologyinformation further includes a display module 13.

The processing module 12 is further configured to generate acorresponding ODN logical topology diagram based on the topologyinformation corresponding to the first PON port.

The display module 13 is configured to display the ODN logical topologydiagram.

An implementation principle and a technical effect of the apparatus forobtaining ODN logical topology information provided in this embodimentare similar to those of the technical solution provided above. Detailsare not described herein again.

FIG. 10 is a schematic structural diagram of non-limiting, exampleEmbodiment 1 of an electronic device. As shown in FIG. 10 , theelectronic device includes:

a memory, a processor, a receiver, a display, and a computer programstored in the memory, and the processor runs the computer program toperform the method for obtaining ODN logical topology informationaccording to any one of the foregoing method embodiments.

Embodiments of this application further provide a storage medium,including a readable storage medium and a computer program stored in thereadable storage medium. The computer program is configured to implementthe method for obtaining ODN logical topology information according toany one of the foregoing method embodiments.

Embodiments of this application further provide a computer programproduct, including: when the computer program product is run on acomputer, the computer is enabled to perform the method for obtainingODN logical topology information according to any one of the foregoingmethod embodiments.

In the foregoing implementations of the electronic device, it should beunderstood that the processor may be a central processing unit (CPU), ormay be another general purpose processor, a digital signal processor(DSP), an application-specific integrated circuit (ASIC), or the like.The general purpose processor may be a microprocessor, or the processormay be any conventional processor or the like. The steps of the methodsdisclosed with reference to embodiments of this application may bedirectly implemented by a hardware processor, or may be implemented by acombination of hardware and a software module in the processor.

All or some of the steps of the foregoing method embodiments may beimplemented by using a program by instructing related hardware. Theforegoing program may be stored in a readable memory. When the programis executed, the steps of the methods in the embodiments are performed.The memory (storage medium) includes a read-only memory (ROM), a RAM, aflash memory, a hard disk, a solid state disk, a magnetic tape, a floppydisk, an optical disc, and any combination thereof.

What is claimed is:
 1. A method for obtaining optical distributionnetwork (ODN) logical topology information, comprising: obtainingidentification information of each first optical network unit (ONU) thatis connected to a first passive optical network (PON) port and whoseoptical path changes and feature data of the first ONU in a first timewindow, wherein the feature data indicates data of a feature of a firstONU; obtaining, based on the obtained feature data of each first ONU, afeature vector corresponding to the first ONU, wherein the featurevector corresponding to the first ONU indicates a change of the featuredata; and performing cluster analysis on the obtained feature vectorcorresponding to each first ONU to obtain topology informationcorresponding to the first PON port, wherein the topology informationcomprises identification information of at least one group of firstONUs, and identification information of each group of first ONUsindicating that the first ONUs in the group are connected to a samenon-level-1 optical splitter, wherein the performing cluster analysis onthe feature vector corresponding to each first ONU to obtain topologyinformation corresponding to the first PON port comprises: obtaining,based on the feature vector corresponding to each first ONU, asimilarity matrix between feature vectors corresponding to any two firstONUs; and using all the obtained similarity matrices as input of acluttering algorithm, to obtain the topology information correspondingto the first PON port.
 2. The method according to claim 1, wherein theobtaining of identification information and feature data of each firstONU that is connected to the first PON port and whose optical pathchanges comprises: obtaining identification information and feature dataof each ONU connected to the first PON port; and filtering out, based onthe feature data, any ONU that is connected to the first PON port andwhose optical path does not change, to select the identificationinformation and the feature data of each first ONU that is connected tothe first PON port and whose optical path changes.
 3. The methodaccording to claim 2, wherein the feature data of each first ONU furthercomprises a distance measuring result.
 4. The method according to claim2, wherein the feature data comprises an alarm event, and the alarmevent comprises an alarm generation time and an alarm type, and thefiltering out, based on the feature data, any ONU that is connected tothe first PON port and whose optical path does not change, to obtain theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changescomprises: comparing a difference between a maximum value and a minimumvalue of receive optical power of an ONU in the first time window with apreset threshold, and filtering out any ONU whose difference between amaximum value and a minimum value of its receive optical power is lessthan the threshold, to obtain the identification information and thefeature data of each first ONU that is connected to the first PON portand whose optical path changes; and/or filtering out, based on the alarmgeneration time and the alarm type of each ONU in the first time window,any ONU whose alarm type does not comprise a preset alarm type, toselect the identification information and the feature data of each firstONU that is connected to the first PON port and whose optical pathchanges.
 5. The method according to claim 1, wherein the obtaining,based on the feature data of each first ONU, a feature vectorcorresponding to the first ONU comprises: for each first ONU, extractinga required feature from the feature data of the first ONU, to form thefeature vector corresponding to the first ONU.
 6. The method accordingto claim 1, wherein the feature data comprises receive optical power andthe feature of the first ONU indicating the change of the receiveoptical power in the first time window comprises at least two of ajitter degree, a quantity of jitters, a cliff degree, a trenddeterioration degree, a relative location of a time at which a minimumvalue appears for the first time, a relative location of a time at whicha maximum value appears for the first time, a proportion of a length ofa longest continuous subsequence in which receive optical power remainsto be greater than an average value, or a proportion of a length of alongest continuous subsequence in which receive optical power remains tobe less than an average value; the jitter degree is a standard deviationor an average deviation of data of the receive optical power of thefirst ONU in the first time window; the quantity of jitters is anaccumulated quantity of times that a jitter degree of the first ONU isgreater than a preset threshold; the cliff degree indicates anattenuation change of the receive optical power of the first ONU from astable value to another stable value in a unit time; and the trenddeterioration degree is indicated by a trend coefficient obtainedthrough linear fitting after an exponential weighted moving average iscomputed on the receive optical power in the first time window.
 7. Themethod according to claim 1, wherein the first PON port comprises atwo-level optical splitting structure, and the method further comprises:performing matrix conversion on a historical clustering result obtainedin each of at least two historical clustering processes corresponding tothe first PON port, to obtain a distance matrix corresponding to thehistorical clustering result, wherein a value in the distance matrixrepresents a distance between any two first ONUs; adding the obtaineddistance matrices corresponding to the historical clustering resultsobtained in the at least two historical clustering processescorresponding to the first PON port, to obtain a comprehensive distancematrix; and performing, based on the obtained comprehensive distancematrix in a density-based clustering manner, cluster analysis on thefirst ONU that is connected to the first PON port and whose optical pathchanges, to update the topology information corresponding to the firstPON port.
 8. The method according to claim 1, further comprising:generating a corresponding ODN logical topology diagram based on theobtained topology information corresponding to the first PON port; andgenerating for display an interface presenting the ODN logical topologydiagram.
 9. An apparatus for obtaining ODN logical topology information,wherein the apparatus comprises: a non-transitory memory storinginstructions; and at least one processor coupled to the non-transitorymemory, wherein the instructions, when executed by the at least oneprocessor, cause the apparatus to: obtain identification information ofeach first optical network unit (ONU) that is connected to a firstpassive optical network (PON) port and whose optical path changes andfeature data of the first ONU in a first time window, wherein thefeature data indicates data of a feature of a first ONU; obtain, basedon the obtained feature data of each first ONU, a feature vectorcorresponding to the first ONU, wherein the feature vector correspondingto the first ONU indicates a change of the feature data; and performcluster analysis on the obtained feature vector corresponding to eachfirst ONU: to obtain topology information corresponding to the first PONport, wherein the topology information comprises identificationinformation of at least one group of first ONUs, and identificationinformation of each group of first ONUs indicates that the first ONUs inthe group are connected to a same non-level-1 optical splitter, whereinthe performing of cluster analysis on the feature vector correspondingto each first ONU to obtain topology information corresponding to thefirst PON port comprises: obtaining, based on the feature vectorcorresponding to each first ONU, a similarity matrix between featurevectors corresponding to any two first ONUs; and using all the obtainedsimilarity matrices as input of a clustering algorithm, to obtain thetopology information corresponding to the first PON port.
 10. Theapparatus according to claim 9, wherein the instructions, when executedby the at least one processor, further cause the apparatus to: obtainidentification information and feature data of each ONU connected to thefirst PON port; and filter out, based on the feature data, any ONU thatis connected to the first PON port and whose optical path does notchange, to select the identification information and the feature data ofeach first ONU that is connected to the first PON port and whose opticalpath changes.
 11. The apparatus according to claim 10, wherein thefeature data of each first ONU further comprises a distance measuringresult.
 12. The apparatus according to claim 10, wherein the featuredata comprises an alarm event, and the alarm event comprises an alarmgeneration time and an alarm type, and the instructions, when executedby the at least one processor, further cause the apparatus to: compare adifference between a maximum value and a minimum value of receiveoptical power of an ONU in the first time window with a presetthreshold, and filter out any ONU whose difference between a maximumvalue and a minimum value of its receive optical power is less than thethreshold, to obtain the identification information and the feature dataof each first ONU that is connected to the first PON port and whoseoptical path changes; and/or filter out, based on the alarm generationtime and the alarm type of each ONU in the first time window, any ONUwhose alarm type does not comprise a preset alarm type, to select theidentification information and the feature data of each first ONU thatis connected to the first PON port and whose optical path changes. 13.The apparatus according to claim 9, wherein the instructions, whenexecuted by the at least one processor, further cause the apparatus to:for each first ONU, extract a required feature from the feature data ofthe first ONU, to form the feature vector corresponding to the firstONU.
 14. The apparatus according to claim 9, wherein the feature datacomprises receive optical power and the feature of the first ONUindicates the change of the receive optical power in the first timewindow comprises at least two of a jitter degree, a quantity of jitters,a cliff degree, a trend deterioration degree, a relative location of atime at which a minimum value appears for the first time, a relativelocation of a time at which a maximum value appears for the first time,a proportion of a length of a longest continuous subsequence in whichreceive optical power remains to be greater than an average value, or aproportion of a length of a longest continuous subsequence in whichreceive optical power remains to be less than an average value; thejitter degree is a standard deviation or an average deviation of data ofthe receive optical power of the first ONU in the first time window; thequantity of jitters is an accumulated quantity of times that a jitterdegree of the first ONU is greater than a preset threshold; the cliffdegree indicates an attenuation change of the receive optical power ofthe first ONU from a stable value to another stable value in a unittime; and the trend deterioration degree is indicated by a trendcoefficient obtained through linear fitting after an exponentialweighted moving average is computed on the receive optical power in thefirst time window.
 15. The apparatus according to claim 9, wherein theinstructions, when executed by the at least one processor, further causethe apparatus to: when the first PON port comprises a two-level opticalsplitting structure, perform matrix conversion on a historicalclustering result obtained in each of at least two historical clusteringprocesses corresponding to the first PON port, to obtain a distancematrix corresponding to the historical clustering result, wherein avalue in the distance matrix represents a distance between any two firstONUs, add the obtained distance matrices corresponding to the historicalclustering results obtained in the at least two historical clusteringprocesses corresponding to the first PON port, to obtain a comprehensivedistance matrix, and perform, based on the obtained comprehensivedistance matrix in a density-based clustering manner, cluster analysison the first ONU that is connected to the first PON port and whoseoptical path changes, to update the topology information correspondingto the first PON port.
 16. The apparatus according to claim 15, whereinthe instructions, when executed by the at least one processor, furthercause the apparatus to: prior to performing the cluster analysis,correct the obtained comprehensive distance matrix by determiningwhether a value of each element in the obtained comprehensive distancematrix is less than a threshold value and, upon determination that thevalue of the element is less than the threshold value, setting the valueof the element to
 0. 17. The apparatus according to claim 9, wherein theinstructions, when executed by the at least one processor, further causethe apparatus to: generate a corresponding ODN logical topology diagrambased on the topology information corresponding to the first PON port;and the apparatus further comprises a display configured to display theODN logical topology diagram.
 18. A non-transitory computer readablestorage medium storing a computer program that when executed by acomputer, cause the computer to perform functions comprising: obtainingidentification information of each first optical network unit (ONU) thatis connected to a first passive optical network (PON) port and whoseoptical path changes and feature data of the first ONU in a first timewindow, wherein the feature data indicates data of a feature of a firstONU; obtaining, based on the obtained feature data of each first ONU, afeature vector corresponding to the first ONU, wherein the featurevector corresponding to the first ONU indicates a change of the featuredata; and performing cluster analysis on the obtained feature vectorcorresponding to each first ONU to obtain topology informationcorresponding to the first PON port, wherein the topology informationcomprises identification information of at least one group of firstONUs, and identification information of each group of first ONUsindicates that the first ONUs in the group are connected to a samenon-level-1 optical splitter, wherein the performing of cluster analysison the feature vector corresponding to each first ONU to obtain topologyinformation corresponding to the first PON port comprises: obtaining,based on the feature vector corresponding to each first ONU, asimilarity matrix between feature vectors corresponding to any two firstONUs; and using all the obtained similarity matrices as input of aclustering algorithm, to obtain the topology information correspondingto the first PON port.